package com.ai.zhly.util;

/**
 * 
 * @Description : 根据时间方式获取Sequence便于数据库操作
 * 
 * @author : wucm
 * @date : 2015年4月6日 上午11:08:29
 * @version V1.0
 * 
 */
public class DBSequence {
	private static DBSequence _oSeqGenerator;
	private long _lID;

	private DBSequence() {
		_lID = 0;
	}

	public final static synchronized DBSequence getInstance() {
		if (_oSeqGenerator == null) {
			_oSeqGenerator = new DBSequence();
		}
		return _oSeqGenerator;
	}

	public synchronized String getSequence() {
		_lID++;
		long lCurTime_ = System.currentTimeMillis() - 1000000000;
		long lTempID_ = _lID + lCurTime_;
		return Long.toString(lTempID_);
	}

	public static void main(String args[]) {
		System.out.println(DBSequence.getInstance().getSequence());
	}
}
